#ifndef TIMELINE_H_INCLUDED
#define TIMELINE_H_INCLUDED

#include "File.h"
#include "Game.h"
#include <algorithm>
#include <string>
#include <map>
#include <utility>


class TimelineKey
{
public:
	TimelineKey() {};
	virtual const char* GetTypeName() = 0;
	virtual bool Load(File* t) { return true; }
	virtual void Execute() = 0;
	virtual ~TimelineKey() {}

	virtual void SetObjId(int i) { m_objID = i;}
protected:
	int m_objID;
};



class Timeline : public Uncopyable
{
public:
	void AddTLK(float time, TimelineKey* tlk);
	bool Load(const std::string& filename);
	void Update();
	void Reset();

private:
	typedef std::multimap<float, TimelineKey*> TLKmap;
	TLKmap m_keys;

	Timeline();
	friend class Singleton<Timeline>;

	float m_elapsedTime;
	TLKmap::iterator m_it;
	
};

typedef Singleton<Timeline> TheTimeline;

#endif



